package com.skynet.supervision.utils.functional;

import java.util.function.Consumer;

@FunctionalInterface
public interface ThrowableConsumer<T, E extends Throwable> {
    void apply(T t) throws E;

    default Consumer<T> toConsumer() {
        return in -> {
            try {
                ThrowableConsumer.this.apply(in);
            } catch (Throwable e) {
                FuncUtils.uncheckedThrow(e);
            }
        };
    }
}


